home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 220 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  4.0 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
  3. Newsgroups: comp.std.internat,comp.software.international,comp.lang.c++,comp.std.c++
  4. Subject: Re: Support for i18n in C++
  5. Date: 01 Feb 1996 09:30:01 PST
  6. Organization: SEL
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <KANZE.96Jan31165136@slsvewt.lts.sel.alcatel.de>
  9. References: <1996Jan24.163403.3059@vmark.co.uk> <4ej4jp$87i@unet.net.com>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: 31 Jan 1996 15:51:36 GMT
  12. In-Reply-To: jyoti@viper.net.com's message of 29 Jan 1996 19:14:53 GMT
  13. Apparently-To: std-c++@ncar.ucar.edu
  14. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  15.     iQBVAwUBMRD44Uy4NqrwXLNJAQFQDwIAqJFkjTZ4XwwPOMFvgQjSfICX2LUqB3wN
  16.     tpj7n7CfLi3aNY6Sgj6THxBo2n4MEskshExVN3ksekMSjKwiNhnhkg==
  17.     =Bj3O
  18. Originator: austern@isolde.mti.sgi.com
  19.  
  20. In article <4ej4jp$87i@unet.net.com> jyoti@viper.net.com (Jyoti Patel,
  21. NMS Engineering) writes:
  22.  
  23. |> I had inquired about this in the internationalization newsgroups but had no 
  24. |> response so I am trying again (with C++ newsgroups as well).
  25.  
  26. |> Anyone know what sort of internationalization (i18n) support is available 
  27. |> for C++? All i18n books talk about printf/scanf and such but none about 
  28. |> cin/cout.
  29.  
  30. |> If any one has any information, I'd appreciate it. If people beleive there
  31. |> isn't one, can you atleast email/post your doubts so I know that the request
  32. |> is being read and that it's just one of those things no one can help me with.
  33.  
  34. What sort of information do you want to know?  The standard goes
  35. considerably farther than the C standard with regards to i18n.  In
  36. particular:
  37.  
  38. 1. All of the C routines (setlocale, etc.) are present.
  39.  
  40. 2. There is even a specific class for locale.  This class is so
  41. designed that an implementation may add additional locale dependancies
  42. in a conforming manner.  (Using such additions, however, makes your
  43. program unportable.)
  44.  
  45. 3. Both the iostreams classes and string are templates on the
  46. character type.  This means that there is full support for wchar_t
  47. data, including all of the conversion functions.  The locale class is
  48. also a template on the character type, so even things like isalpha are
  49. defined for wchar_t.  The iostreams classes also have an imbue
  50. function, to imbue the stream locally with a locale; I presume,
  51. although I've not studied the question in detail yet, that this means
  52. that you can even change the locale on the fly, for a specific stream.
  53. (For example, I'm working in a French locale, with the comma as the
  54. decimal point.  When reading a file, parsing some header information
  55. tells me that it came from Great Britain.  So I imbue that stream with
  56. the GB locale, and it will convert using the period as a decimal
  57. point, without any other streams or functions being affected.)
  58.  
  59. What C++ doesn't support (as yet) is positional parameters, along the
  60. lines of the X/Open extension to printf.  (Although this is not part
  61. of the C standard, it is available on C compilers under Unix, and
  62. maybe elsewhere.)
  63.  
  64. At present, most of this is new, and not available in the
  65. implementations I have.  The intention, as I understand it, is that
  66. wchar_t should become the basic character type for text.  On the other
  67. hand, most existing text files do not use Unicode; on my system, all
  68. of my text files are in ISO 8859-1.  When the vendors actually start
  69. implementing what is in the standard, I will be interested in seeing
  70. how they handle this problem.  Ideally, I will use a wchar_t form of
  71. the iostreams, somehow impart on the stream what the actual external
  72. code set is, and the stream will take care of the rest.
  73. --
  74. James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
  75. GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
  76. Conseils, itudes et rialisations en logiciel orienti objet --
  77.                 -- A la recherche d'une activiti dans une region francophone
  78. ---
  79. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  80.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  81.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  82.